<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui" locale="#{localeBean.locale}">

	<h:head />
	<h:body>
		<ui:composition template="/pages/template/layout.xhtml">
			<ui:define name="content">
				<p:panel styleClass="content" header="#{i18n['editTaxi']}">
					<h:form id="form1">
						<p:messages id="messages" showDetail="true" autoUpdate="true" />
					</h:form>

					<h:panelGroup layout="block" styleClass="edit-taxi">
						<h:form>
							<h:panelGroup layout="block" styleClass="info-form">
								<h:panelGroup layout="block" styleClass="form-item">
									<h:panelGroup layout="block" styleClass="label">
										<h:outputLabel value="#{i18n['taxi']}:" />
									</h:panelGroup>
									<h:panelGroup layout="block" styleClass="field">
										<p:selectOneMenu value="#{taxiBean.selectedTaxi}" effect="fade" converter="taxiConverter">
											<f:selectItem itemLabel="#{i18n['selectTaxi']}" itemValue="" />
											<f:selectItems value="#{taxiBean.allTaxi}" var="taxi" itemLabel="#{taxi.plate}" itemValue="#{taxi}" />
											<p:ajax update="selectedTaxiPanel" listener="#{taxiBean.handleTaxiSelect}" />
										</p:selectOneMenu>
									</h:panelGroup>
								</h:panelGroup>
							</h:panelGroup>

							<p:spacer width="100%" height="20" />

							<h:panelGroup layout="block" id="selectedTaxiPanel" styleClass="info-form">
								<h:panelGroup layout="block" styleClass="form-item">
									<h:panelGroup layout="block" styleClass="label">
										<h:outputLabel value="#{i18n['plate']}:" />
									</h:panelGroup>
									<h:panelGroup layout="block" styleClass="field">
										<p:inputText value="#{taxiBean.taxi.plate}" required="true" />
									</h:panelGroup>
								</h:panelGroup>
								<h:panelGroup layout="block" styleClass="form-item">
									<h:panelGroup layout="block" styleClass="label">
										<h:outputLabel value="#{i18n['brand']}:" />
									</h:panelGroup>
									<h:panelGroup layout="block" styleClass="field">
										<p:inputText value="#{taxiBean.taxi.brand}" required="true" />
									</h:panelGroup>
								</h:panelGroup>
								<h:panelGroup layout="block" styleClass="form-item">
									<h:panelGroup layout="block" styleClass="label">
										<h:outputLabel value="#{i18n['model']}:" />
									</h:panelGroup>
									<h:panelGroup layout="block" styleClass="field">
										<p:inputText value="#{taxiBean.taxi.model}" required="true" />
									</h:panelGroup>
								</h:panelGroup>
								<h:panelGroup layout="block" styleClass="form-item">
									<h:panelGroup layout="block" styleClass="label">
										<h:outputLabel value="#{i18n['prodYear']}:" />
									</h:panelGroup>
									<h:panelGroup layout="block" styleClass="field">
										<p:inputText value="#{taxiBean.taxi.productionYear}" required="true" />
									</h:panelGroup>
								</h:panelGroup>
								<h:panelGroup layout="block" styleClass="form-item">
									<h:panelGroup layout="block" styleClass="label">
										<h:outputLabel value="#{i18n['engineNumber']}:" />
									</h:panelGroup>
									<h:panelGroup layout="block" styleClass="field">
										<p:inputText value="#{taxiBean.taxi.engineNumber}" required="true" />
									</h:panelGroup>
								</h:panelGroup>

								<h:inputHidden value="#{taxiBean.taxi.id}" />
								<h:inputHidden value="#{taxiBean.taxi.station.id}" />
								<h:inputHidden value="#{taxiBean.taxi.location.id}" />

								<h:panelGroup layout="block" styleClass="form-item">
									<p:commandButton styleClass="button" value="#{i18n['update']}" action="#{taxiBean.updateTaxi}" update="@form" />
								</h:panelGroup>

								<p:spacer width="100%" height="20" />
							</h:panelGroup>
						</h:form>
					</h:panelGroup>

				</p:panel>
			</ui:define>
		</ui:composition>
	</h:body>

</f:view>